
package chapter4.No4_1_使用reentrantLock类.demo16;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;

/**
 * Created by Administrator on 2016/11/22.
 */
public class ServiceClass {
    ReentrantLock lock = new ReentrantLock();
    Condition condition = lock.newCondition();

    public void methodA() {
        lock.lock();
        try {
//            condition.await();
            System.out.println("begin");
            condition.awaitUninterruptibly();
            System.out.println("end");
        } catch (Exception e) {
            e.printStackTrace();
        }
        lock.unlock();
    }
}
